num1 = input("输入第一个数字: ")
num2 = input("输入第二个数字: ")

#输入运算符
def count(way):
    if way == '+' :
        print(num1 , way , num2 , '=' , num1 + num2)
    elif way == '-' :
        print(num1 , way , num2 , '=' , num1 - num2)
    elif way == '*':
        print(num1 , way , num2 , '=' , num1 * num2)
    elif way == '/':
        if ( num2 != 0 ):
            print(num1 , way , num2 , '=' , num1 / num2)
        else:
            print('非法运算')
    else :
        print('符号错误，请重新输入')

#属于整数、浮点数返回Flase 反之返回True
def isnotNum(a):
    try:
        float(a)
        return False
    except:
        return True
#判断输入是否为数字
while(isnotNum(num1)):
    print("num1不是数字，请重新输入！")
    num1 = (input("输入第一个数字: "))
while(isnotNum(num2)):
    print("num2不是数字，请重新输入！")
    num2 = (input("输入第二个数字: "))

#将输入的数字转成字符串
num1 = float(num1)
num2 = float(num2)

k = 1
while k == 1 :
    print('请选择你要进行的运算')
    print(' + - * / ')
    way = input()
    if way == '+':
        print(num1, way, num2, '=', num1 + num2)
        k = 2
    elif way == '-':
        print(num1, way, num2, '=', num1 - num2)
        k = 2
    elif way == '*':
        print(num1, way, num2, '=', num1 * num2)
        k = 2
    elif way == '/':
        if (num2 != 0):
            print(num1, way, num2, '=', num1 / num2)
            k = 2
        else:
            print('非法运算')
    else:
        print('符号错误，请重新输入')

